GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

utils.js ➔ ???   A
last analyzed

Complexity

Conditions 1
Paths 4

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 5
Bugs 0 Features 0
Metric Value
cc 1
c 5
b 0
f 0
nc 4
dl 0
loc 5
ccs 1
cts 1
cp 1
crap 1
rs 9.4285
nop 1
1 39
export const isInt = (val) => !isNaN(val)
2
    && (
3
        Number.isInteger(val)
4
        || (typeof val === 'string' && '' + parseInt(val, 10) === val)
5
    );
6
7
8 26
export const isFloat = (val) => !isNaN(val)
9
    && !isInt(val)
10
    && val.toString().length > 0;
11
12 64
export const isColor = (val) => /^#?[0-9A-F]{6}$/i.test(val);
13
14 1
export const autoCast = (value) => {
15 56
    if (!value) {
16 2
        return value;
17
    }
18
19 54
    if (isColor(value)) {
20 34
        return ('#' + value).replace('##', '#');
21
    }
22
23 20
    if (isInt(value)) {
24 4
        return parseInt(value, 10);
25
    }
26
27 16
    if (isFloat(value)) {
28 6
        return parseFloat(value);
29
    }
30
31 10
    if (value.toLowerCase() === 'true') {
32 3
        return true;
33
    }
34
35 7
    if (value.toLowerCase() === 'false') {
36 2
        return false;
37
    }
38
39 5
    return value;
40
};
41
42
43 1
export const castString = (str) => {
44 103
    if (typeof str !== 'string' && !(str instanceof String)) {
45 4
        str = '' + str;
46
    }
47
48 103
    return str.toLowerCase();
49
};
50